<?php
/**
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2018/2/3
 * Time: 14:56
 */

namespace App\Http\Controllers\MiniProgramAdmin;


use App\Http\Logics\MiniProgramAdmin\RoleLogic;
use App\Http\Traits\RoleTrait;
use App\Role;
use App\Http\Controllers\BaseController;
class RoleController extends BaseController
{
    use RoleTrait;
    /**
     * @SWG\Get(
     *     path="/role/list",
     *     tags={"Role"},
     *     description="获取角色列表",
     *     operationId="getRoleList",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         type="string"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getRoleList()
    {
        $data = [
            'type' => Role::YIICCA
        ];
        $response = RoleLogic::getRoleList($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Get(
     *     path="/role/detail",
     *     tags={"Role"},
     *     description="获取角色详情",
     *     operationId="getRoleDetail",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="role_id",
     *         in="query",
     *         description="角色ID",
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getRoleDetail()
    {
        $role_id = $this->role_id;
        $data = [
            'role_id' => $role_id
        ];
        $response = RoleLogic::getRoleDetail($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }
}